package org.shell.utils.config;

import java.util.Arrays;
import java.util.HashMap;

public class ConfigImpl implements Config {

    private static Config config = null;
    private HashMap<String, Object> props;

    public ConfigImpl() {
        props = new HashMap<String, Object>();
    }

    public static Config getInstance() {
        if (config == null) {
            config = new ConfigImpl();
        }
        return config;
    }

    public void setProperty(String name, Object value) {
        props.put(name, value);
    }

    public Object getProperty(String name) {
        return props.get(name);
    }

    public boolean isPropertySet(String name) {
        return props.get(name) != null ? true : false;
    }

    public String[] list() {
        return props.keySet().toArray(new String[]{});
    }
}
